package com.l024.loanthief.views.MainPage;

import android.util.SparseArray;

import androidx.annotation.NonNull;
import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentManager;
import androidx.fragment.app.FragmentPagerAdapter;

/**
 * @author wu_ming_zhi_bei
 * @date 2021/1/15 15:58
 * @Notes
 */
public class NavFragmentPagerAdapter extends FragmentPagerAdapter {

    private FragmentManager mfragmentManager;
    private SparseArray<Fragment> mlist;

    public NavFragmentPagerAdapter(@NonNull FragmentManager fm, SparseArray<Fragment> list) {
        super(fm,BEHAVIOR_RESUME_ONLY_CURRENT_FRAGMENT);
        this.mlist = list;
    }

    @NonNull
    @Override
    public Fragment getItem(int position) {
        return mlist.get(position);
    }

    @Override
    public int getItemPosition(Object object) {
        return POSITION_NONE;
    }

    @Override
    public long getItemId(int position) {
        return mlist.get(position).hashCode();
    }

    @Override
    public int getCount() {
        return mlist.size();
    }
}
